package com.lianzhihui.romeex.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lianzhihui.romeex.R;
import com.lianzhihui.romeex.bean.TradeRecordEarningsBean;
import com.lianzhihui.romeex.utils.DateUtil;

import java.util.List;

/**
 * Description: 主页适配器
 * Author: RAMON
 * CreateDate: 2020/11/4 8:10 PM
 * UpdateUser:
 * UpdateDate:
 * UpdateRemark:
 * Version:
 */
public class TradeEarningsRecordAdapter extends BaseQuickAdapter<TradeRecordEarningsBean.ContentBean, BaseViewHolder> {

    String coinName;

    public TradeEarningsRecordAdapter(@Nullable List<TradeRecordEarningsBean.ContentBean> data) {
        super(R.layout.item_trade_record_layout, data);
    }

    public void setCoinName(String coinName) {
        this.coinName = coinName;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, TradeRecordEarningsBean.ContentBean item) {
        helper.setImageResource(R.id.iv_icon, item.getIconType());
        helper.setVisible(R.id.item_tv_status, false);
        helper.setText(R.id.item_tv_address, item.getTitle())
                .setText(R.id.item_tv_sum, item.getBalance() + item.getCoinName())
                .setText(R.id.item_tv_date, DateUtil.sec2Date(item.getTimeStamp()));
    }
}
